<html>
<head>
    <link href="${ctx}/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/font-awesome/3.0.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="${ctx}/css/index.css" rel="stylesheet">
    <link href="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.css" rel="stylesheet">
    <script src="${ctx}/jquery/2.1.4/jquery.min.js"></script>
    <script src="${ctx}/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="${ctx}/bootstrap-table/1.12.0/bootstrap-table.min.js"></script>
    <link href="${ctx}/wangEditor/3.1.1/wangEditor.min.css" rel="stylesheet">
    <script src="${ctx}/wangEditor/10.0.13/wangEditor.min.js"></script>
    <script src="${ctx}/js/iw.js"></script>
    <link href="${ctx}/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet">
    <script src="${ctx}/bootstrap-switch/js/bootstrap-switch.min.js"></script>
    <style>
        [class*='col-xs-'] {
            margin-bottom: 10px;
        }

        .hide {
            display: none;
        }

        .align-right {
            text-align: right;
            padding-right: 0;
            line-height: 34px;
            font-size: 14px;
        }
    </style>

</head>
<body class="container-fuild" style="padding-top: 8px;height: 200px">
<form class="form-horizontal" id="form">
    <div class="form-group">
        <div class="col-sm-9">
            <input type="hidden" style="display:none;" id="id" name="id" value="${item.id!''}">
        </div>
    </div>
    <div class="form-group">
        <label for="icon" class="col-xs-3 align-right">提现金额：</label>
        <div class="col-xs-8">
            <input type="number" class="form-control" id="cashMoney" max="1000" min="0" name="cashMoney"
                   placeholder="填入提现金额" value="${item.cashMoney!''}">
        </div>
    </div>

</form>
<button style="width: 65px;margin-left: 150px" class="btn btn-success" onclick="save()">保存</button>

<script>

    function save() {
        var cashMoney = $('#cashMoney').val();
        if (cashMoney == null || cashMoney == "") {
            alert("金额不能为空")
            return;
        }
        var id = $('#id').val();
        var data = {"id": id, "cashMoney": cashMoney}

        $.ajax({
            url: "/cash/edit",    //请求的url地址
            dataType: "json",   //返回格式为json
            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
            data: data,    //参数值,键值对
            type: "post",   //请求方式
            beforeSend: function () {
                //请求前的处理
            },
            success: function (res) {
                if (res.success) {
                    alert(res.message);
                    window.parent.iw.closeDialog();
                } else {
                    alert(res.message);
                }
            },
            complete: function () {
                //请求完成的处理
            },
            error: function () {
                //请求出错处理
                alert("请重试！若在失败请联系管理员")
            }
        });
    }


</script>
</body>
</html>
